package com.xssq.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xssq.domain.User;
import com.xssq.service.UserService;
import com.xssq.mapper.UserMapper;
import com.xssq.utils.response.R;
import org.springframework.stereotype.Service;

/**
* @author Administrator
* @description 针对表【user(用户表)】的数据库操作Service实现
* @createDate 2023-07-22 21:54:10
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
    implements UserService{


    @Override
    public R remove(User user) {

        LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(User::getUsername, user.getUsername());
        lambdaQueryWrapper.eq(User::getPassword, user.getPassword());
        if (baseMapper.delete(lambdaQueryWrapper) > 0) {
            return R.ok("删除成功");
        }
        return R.fail("删除失败,用户不存在");
    }
}




